//
// Created by gogoqiu on 2021/8/22.
//

#ifndef WXTEST_PREFERENCESCREEN_H
#define WXTEST_PREFERENCESCREEN_H

#include <map>
#include "wx/wx.h"

#include "wx/imaglist.h"
#include "wx/listctrl.h"
#include "wx/timer.h"           // for wxStopWatch
#include "wx/colordlg.h"        // for wxGetColourFromUser
#include "wx/settings.h"
#include "wx/sizer.h"
#include "wx/sysopt.h"
#include "wx/numdlg.h"
#include "wx/selstore.h"

#include "data/Preference.h"
// IDs for the menu commands
enum
{
    LIST_ABOUT = wxID_ABOUT,
    LIST_QUIT = wxID_EXIT,

    LIST_LIST_VIEW = wxID_HIGHEST,
    LIST_ICON_VIEW,
    LIST_ICON_TEXT_VIEW,
    LIST_SMALL_ICON_VIEW,
    LIST_SMALL_ICON_TEXT_VIEW,
    LIST_REPORT_VIEW,
    LIST_VIRTUAL_VIEW,
    LIST_SMALL_VIRTUAL_VIEW,
    LIST_SET_ITEMS_COUNT,

    LIST_DESELECT_ALL,
    LIST_SELECT_ALL,
    LIST_DELETE_ALL,
    LIST_DELETE,
    LIST_ADD,
    LIST_EDIT,
    LIST_SORT,
    LIST_FIND,
    LIST_SET_FG_COL,
    LIST_SET_BG_COL,
    LIST_ROW_LINES,
    LIST_CUSTOM_HEADER_ATTR,
    LIST_TOGGLE_MULTI_SEL,
    LIST_TOGGLE_HEADER,
    LIST_TOGGLE_BELL,
    LIST_TOGGLE_CHECKBOX,
    LIST_GET_CHECKBOX,
    LIST_TOGGLE_CHECKBOXES,
    LIST_TOGGLE_FIRST,
    LIST_SHOW_COL_INFO,
    LIST_SHOW_SEL_INFO,
    LIST_SHOW_VIEW_RECT,
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
    LIST_SET_COL_ORDER,
    LIST_GET_COL_ORDER,
#endif // wxHAS_LIST_CTRL_COLUMN_ORDER
    LIST_GOTO,
    LIST_FOCUS_LAST,
    LIST_FREEZE,
    LIST_THAW,
    LIST_TOGGLE_LINES,

    LIST_CHECK_VISIBILITY,
    LIST_CTRL                   = 1000
};

/*
 * ???????????????????
 */
/*
class PreferenceListCtrl: public wxListCtrl
{
public:
    PreferenceListCtrl(wxWindow *parent,
                       const wxWindowID id,
                       const wxPoint& pos,
                       const wxSize& size,
                       long style)
            : wxListCtrl(parent, id, pos, size, style)
    {
        m_updated = -1;

    }

    // add one item to the list ctrl in report mode
    void InsertItemInReportView(int i);

    void OnSelected(wxListEvent& event);

    void OnListKeyDown(wxListEvent& event);
    void OnActivated(wxListEvent& event);
    void OnFocused(wxListEvent& event);
    void OnRightClick(wxMouseEvent& event);

private:

    long m_updated;

    // checked boxes in virtual list
    wxSelectionStore m_checked;

wxDECLARE_NO_COPY_CLASS(PreferenceListCtrl);
wxDECLARE_EVENT_TABLE();
};*/

/*
 * ???????????????????
 * listview
 */
/*
class PreferenceFrame: public wxFrame
{
public:
    explicit PreferenceFrame(const wxString& title);
    ~PreferenceFrame() override;

protected:
    void OnQuit(wxCommandEvent& event);
    void OnListView(wxCommandEvent& event);
    void OnReportView(wxCommandEvent& event);

    //wxImageList *m_imageListNormal;
    wxImageList *m_imageListSmall;

    wxPanel *m_panel;
    PreferenceListCtrl *m_listCtrl;
    //wxTextCtrl *m_logWindow;

private:

    void InitWithReportItems();

    //wxLog *m_logOld;
    int m_numListItems;

    wxDECLARE_NO_COPY_CLASS(PreferenceFrame);
    wxDECLARE_EVENT_TABLE();
};
*/

struct ViewList{
    wxString key;
    wxString title;
    PreferenceType type;

    ViewList( const wxString& key, const wxString& title, PreferenceType type ){
        this->key = key;
        this->title = title;
        this->type = type;
    }
};

class PreferenceScreen {
protected:
    vector<PreferenceView*> preferenceViews;
    //virtual void buildViewList() = 0;
    //std::map<wxString,wxString > list;

    virtual void buildList() = 0;

    virtual ViewList* getTitle( wxString key )=0;
};


#endif //WXTEST_PREFERENCESCREEN_H
